package com.tran.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.tran.demo.event.OrderEvent;
import com.tran.demo.model.Order;

@Controller
@RequestMapping("/order")
public class OrderController {
	
	@Autowired
	private ApplicationContext con;
	
	@RequestMapping("/orderCreate")
	public void create() {
		
		System.out.println("订单创建------------------");
		System.out.println("订单入库------------------");
		
		/*System.out.println("订单入库------------------");
		  System.out.println("短信通知------------------");
		  System.out.println("app站内通知------------------");
		  System.out.println("微信站内通知------------------");*/
		
		Order order = new Order();
		order.setId("123");
		order.setName("测试订单");
		
		OrderEvent event = new OrderEvent(order);
		con.publishEvent(event);
	}
}
